package shejimoshi.zerenlianmoshi;
// 具体处理者实现1
public class ConcreteHandler1 extends AbstractHandler {
    @Override
    public void handleRequest(Request request) {
        if (canHandle(request)) {
            System.out.println("ConcreteHandler1 handled the request for type " + request.getType());
        } else if (next != null) {
            next.handleRequest(request);
        } else {
            System.out.println("No handler found for request type " + request.getType());
        }
    }

    private boolean canHandle(Request request) {
        return "A".equals(request.getType());
    }
}
